home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / OPTYPE.MOD < prev    next >
Text File  |  1989-01-18  |  1KB  |  47 lines

  1.                                      (* Chapter 13 - Program 9 *)
  2. MODULE OpType;
  3.  
  4. FROM InOut      IMPORT WriteString, WriteCard, WriteLn;
  5. FROM OpaqueType IMPORT BoxType, MakeBox, Volume, Area;
  6.  
  7. VAR Big, Little, Tiny : BoxType;
  8.     TempVal           : CARDINAL;
  9.  
  10. BEGIN
  11.  
  12.    Big    := MakeBox(12,8,11);  (* Create and initialize a box *)
  13.    Little := MakeBox(2,4,3);    (* Create and initialize a box *)
  14.    Tiny   := MakeBox(1,1,1);    (* Create and initialize a box *)
  15.  
  16.    WriteString("The big box has a volume of ");
  17.    TempVal := Volume(Big);
  18.    WriteCard(TempVal,4);
  19.    WriteString(" units.");
  20.    WriteLn;
  21.  
  22.    WriteString("The little box has an area of ");
  23.    WriteCard(Area(Little),4);
  24.    WriteString(" units.");
  25.    WriteLn;
  26.  
  27.    (* This is comparing the opaque values, in this case pointers *)
  28.  
  29.    IF Little # Big THEN
  30.       WriteString("The little box and the big box are not equal.");
  31.       WriteLn;
  32.    END;
  33.  
  34. END OpType.
  35.  
  36.  
  37.  
  38.  
  39. (* Result of execution
  40.  
  41. The big box has a volume of 1056 units.
  42. The little box has an area of   52 units.
  43. The little box and the big box are not equal.
  44.  
  45. *)
  46.  
  47.